package StudyCode.summary.mydatetime;

import java.util.Calendar;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CalendarAddOrSubtractWeek {
	public static void main(String[] args) {
		Calendar calendar = Calendar.getInstance();
		System.out.println("当前日期 : " + (calendar.get(Calendar.MONTH) + 1) + "-" + calendar.get(Calendar.DATE) + "-" + calendar.get(Calendar.YEAR));

		calendar.add(Calendar.WEEK_OF_YEAR, 1);

		System.out.println("加一周后 : " + (calendar.get(Calendar.MONTH) + 1) + "-" + calendar.get(Calendar.DATE) + "-" + calendar.get(Calendar.YEAR));

		calendar = Calendar.getInstance();
		calendar.add(Calendar.WEEK_OF_YEAR, -10);

		System.out.println("减去10周 : " + (calendar.get(Calendar.MONTH) + 1) + "-" + calendar.get(Calendar.DATE) + "-" + calendar.get(Calendar.YEAR));

	}
}
